<%-- 
    Document   : view
    Created on : 17 avr. 2013, 19:18:54
    Author     : xarckane
--%>

<%@page import="shared.ProcessList"%>
<%@page import="java.util.List"%>
<%@page import="persistance.DaoHistorique"%>
<%@page import="local.Historique"%>
<%@page import="java.util.ArrayList"%>
<%@page import="persistance.DaoCpu"%>
<%@page import="persistance.DaoMemory"%>
<%@page import="persistance.DaoProcessus"%>
<%@page import="sun.nio.cs.HistoricallyNamedCharset"%>
<%@page import="shared.Process"%>
<%@page import="shared.Memory"%>
<%@page import="shared.Cpu"%>
<%@page import="shared.Monitoring"%>
<%@page import="rmi.RmiClient"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
               <link rel="stylesheet" type="text/css" href="/TpMonitoringJu/css/bootstrap.css" >
        <link rel="javascript" type="text/javascript" href="/TpMonitoringJu/js/bootstrap.js">
        <link rel="javascript" type="text/javascript" href="/TpMonitoringJu/js/jquery.spin.js">
        <link rel="javascript" type="text/javascript" href="/TpMonitoringJu/js/spin.min.js">

    </head>
    <body>
        <h1></h1>
        serveur : <%= request.getParameter("rmi")%>  <br>
        type : <%= request.getParameter("action")%> 

        

        <% if (request.getParameter("action").equals("cpu")) {%>

 <table border="1" bordercolor="#330000" style="background-color:#FFFFFF" width="100%" cellpadding="3" cellspacing="3">
            <tr>
                <td>us: user cpu time (or) % CPU time spent in user space</td>
                <td>sy: system cpu time (or) % CPU time spent in kernel space</td>
                <td>ni: user nice cpu time (or) % CPU time spent on low priority processes</td>
                <td>id: idle cpu time (or) % CPU time spent idle</td>
                <td>wa: io wait cpu time (or) % CPU time spent in wait (on disk)</td>
                <td>hi: hardware irq (or) % CPU time spent servicing/handling hardware interrupts</td>
                <td>si: software irq (or) % CPU time spent servicing/handling software interrupts</td>
                <td>st: steal time - - % CPU time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) % CPU time stolen from a virtual machine
                <td>load1</td>
                <td>load5</td>
                <td>load15</td>
                
            </tr>
            <tr>
                <td><%= ((Cpu) request.getAttribute("cpu")).getUs()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getSy()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getNi()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getId()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getWa()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getHi()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getSi()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getSt()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getLoa1()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getLoa5()%></td>
                <td><%= ((Cpu) request.getAttribute("cpu")).getLoa15()%></td>
            </tr>
        </table>



        <% }if (request.getParameter("action").equals("process")) {%>
            <%!  ProcessList process = null; %>
            <% process = (ProcessList)request.getAttribute("processList"); %>
            
    
        <table border="1" bordercolor="#330000" style="background-color:#FFFFFF" width="100%" cellpadding="3" cellspacing="3">
            <tr>
                <td>name</td>
                <td>pid</td>
            </tr>

            <% for (shared.Process proc : process.getListe()) {%>
            <tr><td> <%= proc.getName()%> </td>
                <td> <%= proc.getPid()%> </td><tr>
                <% }%>

        </table>
        <%
            }   if (request.getParameter("action").equals("memory")) {%>


    
<table border="1" bordercolor="#330000" style="background-color:#FFFFFF" width="100%" cellpadding="3" cellspacing="3">
            <tr>
                <td>free</td>
                <td>used</td>
                <td>total</td>
                </td>
            </tr>
            <tr>
                <td><%=((Memory) request.getAttribute("mem")).getFree()%></td>
                <td><%= ((Memory) request.getAttribute("mem")).getUsed()%> </td>
                <td><%= ((Memory) request.getAttribute("mem")).getTotal()%></td>

            </tr>
        </table>
        <%
            }%>























    </body>
</html>
